const axios = require('axios');
const { downloadImage } = require('../../utils');

async function main() {
  const r = await axios.post('http://localhost:5188/list/goods', {pageNo:0, pageSize: 10, sort: 'createTime'});
  const list = r.data.result.list;
  for (const item of list) {
    downloadImage(item.image, 'image', `img/${item.name}`);
    for (let i in item.banners) {
      downloadImage(item.banners[i], 'banners' + i, `img/${item.name}/banners`);
    }
    for (let i in item.imageList) {
      downloadImage(item.imageList[i], 'imageList' + i, `img/${item.name}/imageList`);
    }
  }
  console.log('down');
}

main()